package com.aidansmeaton;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import arnodenhond.graphviewdemo.GraphView;

import com.aidansmeaton.internet.ParseHelper;
import com.aidansmeaton.internet.PassengerNameValue;

public class DashboardActivity extends WebViewActivity {
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dashboard);
		
		url = "http://www.airwaysim.com/game/Office";
		loadWebView();
		
	}
	
	public void changeGame(View v){
		Intent i = new Intent(getBaseContext(), ChangeGameActivity.class);
        startActivity(i);
        finish();
	}
	
	public void logOut(View v){
		Intent i = new Intent(getBaseContext(), LogoutActivity.class);
        startActivity(i);
        finish();
	}
	
	public void office(View v){
		Intent i = new Intent(getBaseContext(), DeskActivity.class);
        startActivity(i);
	}

	@Override
	protected void loadWebView() {
		
		webview = new WebView(myApp);
		webview.getSettings().setJavaScriptEnabled(true);
		webview.addJavascriptInterface(new OverviewJavaScriptInterface(), "HTMLOUT");
		webview.getSettings().setSaveFormData(true);
		webview.getSettings().setBuiltInZoomControls(true);
		webview.setWebViewClient(new HTMLWebViewClient());
		webview.loadUrl(url); // 'html' instance variable is also loaded here
		
	}
	
	protected class OverviewJavaScriptInterface	{
		
	    public void showHTML(String pageHTML) {
	    	html = pageHTML;
	    }
	}
	
}